﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Wap/Web/WebSite.master" CodeBehind="CouponActivity.aspx.cs" Inherits="ZLCMS.Web.Wap.Web.CouponActivity" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="css/coupon.css" rel="stylesheet" type="text/css" />
    <script src="/Wap/lib/command/Command.js" type="text/javascript"></script>
    <script src="/Wap/lib/jquery/jquery.json-2.2.min.js" type="text/javascript"></script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="main" runat="server">

<div data-role="main" class="ui-content">

<div class="coupon_box">
      <div class="top" style="background-image:url(<%=Background%>); background-repeat:no-repeat; background-size:cover;">
        <div class="title">
          <h1><%=Rule.Title %></h1>
          <h2>活动时间:<%=string.Format("{0:yyyy-MM-dd}",Rule.StartGetDate) %>至<%=string.Format("{0:yyyy-MM-dd}",Rule.EndGetDate) %></h2>
        </div>
        <div class="price">
           <div class="p1"><font size="+0.5">面值</font>
           <%for (int i = 0; i < ItemList.Count; i++)
             { %>
           <%=ItemList[i].Amount%><%if (i + 1 < ItemList.Count){ %>/<%} %><%} %>

           </div>
           <div class="p2"><%=Rule.Summary%></div>
        </div>
      </div>

      <div class="btn_con" id='getcontainer'>
        <a class="btn" onclick="getCoupon()">立即领取</a>
      </div>
      <div class="btn_con" id='nogetcontainer'>
        <a class="btn ed">已领取</a>
      </div>
      <div class="btn_con">
        <a class="btn" data-ajax="false" href="/wap/shop/CouponList.aspx">我的优惠券>></a>
      </div>
    <div class="bg_2"></div>
      <div class="con">
        <h3>使用说明</h3>
        <div>
        <%=Rule.Memo %>
        </div>
      </div>
      </div>
</div>


<script type="text/javascript">
var getable=false;
$(document).ready(function () {
setGetable(<%=CouponGetable?"true":"false" %>);
<%if(Rule.StartGetDate > DateTime.Now || Rule.Status == "0"){ %>
showTips('活动还没启动', 3000);
<%}else if(Rule.EndGetDate < DateTime.Now || Rule.Status == "2"|| Rule.Status == "9"){ %>
showTips('活动已结束', 3000);
<%} %>
})

function setGetable(val){
 if(val == true){
 $('#getcontainer').show();
 $('#nogetcontainer').hide();
 }else{
 $('#getcontainer').hide();
 $('#nogetcontainer').show();
 }
 getable=val;
}

function getCoupon(){
    if(getable==false){
        showTips('优惠券已达领取上限', 3000);
        return;
    }
    var param = {};
    param.RuleId='<%=Rule.Id %>';
    param.MemberAccount='<%=CurrentMemberAccount %>';
    $(document).executeCommand({
    
        successCallBack:function(result,totalcnt){
            showTips('领取成功')
            setGetable(result>0);
        },
        errorCallback:function(errorCode, msg){
            showTips(msg)
        }
    }

    ,'GetCoupon',param);
}
</script>
</asp:Content>








<%--
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>领取优惠券</title>
    <meta charset="utf-8">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <link href="css/coupon.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="coupon_box">
      <div class="top">
        <div class="title">
          <h1><%=Rule.Title %></h1>
          <h2>活动时间:<%=string.Format("{0:yyyy-MM-dd}",Rule.StartGetDate) %>至<%=string.Format("{0:yyyy-MM-dd}",Rule.EndGetDate) %></h2>
        </div>
        <div class="price">
           <div class="p1"><font size="+0.5">面值</font>
           <%for (int i = 0; i < ItemList.Count; i++)
             { %>
           <%=ItemList[i].Amount%>
           <%if (i + 1 < ItemList.Count)
             { %>/<%} %>
           <%} %>

           </div>
           <div class="p2"><%=Rule.Summary%></div>
        </div>
      </div>

      <div class="btn_con">
        <a class="btn">立即领取</a>
      </div>
    <div class="bg_2"></div>
      <div class="con">
        <h3>使用说明</h3>
        <div>
        <%=Rule.Memo %>
        </div>
      </div>
      </div>
    </form>
</body>


</html>--%>
